FROM golang:1.18 AS builder

ENV TZ Asia/Shanghai
ENV CGO_ENABLED 0
ENV GO111MODULE on
ENV GOPROXY https://goproxy.io,direct

WORKDIR /build

# ADD go.mod .
# ADD go.sum .
COPY . .

RUN go mod tidy
RUN go build -o /app/hook ./main.go

FROM alpine:latest

ENV TZ Asia/Shanghai

WORKDIR /app

COPY --from=builder /app/hook /app/hook
COPY --from=builder /build/conf /app/conf

EXPOSE 8080

CMD ["./hook"]
